var windowName = "classInfo";
var Page,count = 0
apiready = function(){
    onWindowShow(function () {
        api.setScreenOrientation({
            // orientation: 'portrait_down'
            orientation: 'auto_portrait'
        });
        if (count > 0) {
            getData(Page);
        }
        count ++

    })
    onWindowHide(function () {
    })
    console.log("index page is OK");


    Page = createVM("#Page",{
        //页面数据
        curTab:0
        ,id:0
        ,topic:{
            title:"正在获取信息……"
        }
        ,teacher:{
            pic:picUserHead
            ,name:""
            ,intro:"正在获取信息……"
        }
        ,list:[]
    },{
        //页面方法
        "init":function () {
            var data = getData4Page()
            this.id = data.id
            getData(this)

            var arr = "index_0_1".split("_")
            logJson(arr,"arr test:")


        }
        ,tab:function (index) {
            this.curTab = index
        }
    })
    Page.init()
}

function getData(_this) {
    apiLoad("/app/getTopicInfo",{id:_this.id},function (res) {
        // log(res)
        _this.teacher = res.d.teacher
        _this.topic = res.d.topic
        _this.list = res.d.list
    });
}

